<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/


//api接口路由
Route::group(['middleware' => ['auth.token']], function(){//验证token是否正确
    //用户模块
    Route::group(['middleware' => ['auth']], function(){//验证用户是否登录
        Route::group(['prefix' => 'api/my/user'], function(){
            Route::get('', 'Api\My\UserController@index');
        });
        Route::group(['prefix' => 'api/userCart'], function(){
            Route::post('set', 'Api\UserCart\UserCartController@setUserCart');
            Route::get('empty', 'Api\UserCart\UserCartController@emptCart');
        });

        Route::group(['prefix' => 'api/order'],function(){
            Route::post('create', 'Api\Order\OrderController@createOrder');
        });
    });


});


Route::group(['prefix' => 'api/system/token'],function(){
    Route::post('/create', 'Api\System\TokenController@createToken');
});


//admin路由
Route::group(['middleware' => 'auth:web'], function(){
    Route::group(['middleware' => 'right'], function(){
        Route::group(['prefix' => 'admin/user/user'], function(){
            Route::get('', 'Admin\User\UserController@index');
        });
    });

});

Route::group(['prefix' => 'admin/system/login',['middleware' => 'web']], function(){
    Route::get('', 'Admin\System\LoginController@index');
    Route::post('login', 'Admin\System\LoginController@login');
    Route::get('logout', 'Admin\System\LoginController@logout');
});

Route::group(['prefix' => 'test'],function(){
    Route::get('', 'Test\TestController@index');
    Route::get('/test', 'Test\TestController@test');
    Route::get('/redis', 'Test\TestController@redis');
    Route::get('/testredis', 'Test\TestController@testRedis');
    Route::get('/total', 'Test\TestController@showTotal');
    Route::get('/add', 'Test\TestController@muiltDataBaseAdd');
});



